import { config } from '../static/menu'

// 中英文汉字转换方法---配置
export const chineseTransform = (name) => config[name]

// 转换毫秒为时、分、秒展示
export const transformMillionSecondToSecond = (time) => {
    let timeInfo = {
        hour: 0,
        minute: 0,
        second: 0,
        timeStr: ''
    }
    time = parseInt(time / 1000);
    timeInfo.hour = parseInt(time / 3600);
    timeInfo.minute = parseInt((time % 3600) / 60);
    timeInfo.second = (time % 3600) % 60;
    let {hour, minute, second} = timeInfo;
    // hour = parseInt(hour);
    // minute = (hour ? (minute - hour * 60) : minute) + (timeInfo.hour - hour) * 60;
    // console.log(minute,timeInfo.hour - hour, "m");
    // minute = parseInt(minute);
    // second = (minute ? ( second - minute * 60) : second) + (timeInfo.minute - minute) * 60;
    // console.log(second,timeInfo.minute - minute, 's');
    // second = parseInt(second);
    timeInfo.timeStr = (hour ? `${hour}小时` : '') + (minute ? `${minute}分钟` : '') + (second ? `${second}秒` : '');
    return timeInfo.timeStr;
}